﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace POS
{

        public partial class Server : Form
        {
            public static Server _main;

            public Server()
            {
                _main = this;
            }
            private static bool HasStartup = false;

            public static void StartServer()
            {
                if (!HasStartup)
                {
                    try
                    {
                        Networking.AsynchronousSocketListener.Port = "11000";
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }
                    Networking.AsynchronousSocketListener.Server = Server._main;
                    Thread listener = new Thread(new ThreadStart(Networking.AsynchronousSocketListener.StartListening));
                    listener.IsBackground = true;
                    listener.Start();
                    HasStartup = true;
                }

                MessageBox.Show("");
            }
        }
    
}
